package utils;

import org.apache.commons.lang3.StringUtils;

public class UrlUtils {

    public static String getRequestUrl(String url){

        if (!StringUtils.startsWithAny(url,"http://","https://")){
            url = "http://" + url;
        }
        return url;
    }

    public static String getImgUrl(String resUrl,String url){
        if (StringUtils.startsWith(url,"//")){
            return "https:" + url;
        }else if (StringUtils.startsWith(url,"/")){
            return resUrl + url;
        }else if (StringUtils.startsWith(url,"https:")){
            return url;
        }else {
            return resUrl+ "/" + url;
        }
    }

}
